<div class="toolbar">
  <a class="btn" href="javascript:window.history.back();"><i class="icon-arrow-left"></i></a>
  <div class="btn-group">
    <a class="groups btn dropdown-toggle" ng-click="initGroups()" ng-class="{hide: user.uid == null}" data-toggle="dropdown">
      <i class="icon-th-list"></i>
      Roles
      <span class="caret"></span>
    </a>
    <div groups-dropdown></div>
  </div>
  <div class="btn-group">
    <a class="actions btn dropdown-toggle" ng-class="{hide: user.uid == null}" data-toggle="dropdown">
      Actions
      <span class="caret"></span>
    </a>
    <ul class="dropdown-menu">
      <li><a ng-click="deleteUser(user)" class="delete">Delete user</a></li>
    </ul>
  </div>
</div>
<hr />
<form class="form-fixed" action="" name="userForm">

  <div class="row-fluid">
    <div class="span6">
      <div class="control-group">
        <label>Login</label>
        <input type="text" name="uid" ng-model="user.uid" placeholder="Login" class="span12"/>
      </div>
    </div>
    <div class="span6">
      <div class="control-group">
        <label>Password</label>
        <a href="{{publicContextPath}}/account/passwordRecovery?email={{user.mail | encodeURIComponent}}">Reset password</a>
      </div>
    </div>
  </div>
  <div class="row-fluid">
    <div class="span6">
      <div class="control-group" ng-class="{error: userForm.sn.$invalid}">
        <label>Last Name</label>
        <input type="text" name="sn" ng-model="user.sn" required  placeholder="Last Name" class="span12"/>
        <span ng-show="userForm.sn.$error.required" class="help-inline">Required</span>
      </div>
    </div>
    <div class="span6">
      <div class="control-group" ng-class="{error: userForm.givenName.$invalid}">
        <label>First Name</label>
        <input type="text" name="givenName" ng-model="user.givenName" required  placeholder="First Name" class="span12"/>
        <span ng-show="userForm.givenName.$error.required" class="help-inline">Required</span>
      </div>
    </div>
  </div>
  <div class="row-fluid">
    <div class="span6">
      <div class="control-group" ng-class="{error: userForm.mail.$invalid}">
        <label>E-Mail</label>
        <input type="email" name="mail" ng-model="user.mail" required class="span12"/>
        <span ng-show="userForm.mail.$error.required" class="help-inline">Required</span>
        <span ng-show="userForm.mail.$error.email" class="help-inline">Not a valid E-mail</span>
      </div>
    </div>

    <div class="span3">
      <div class="control-group">
        <label class="control-label" for="telephone">Phone</label>
        <div class="controls">
          <input id="telephone" name="telephone" ng-model="user.telephoneNumber" type="text" placeholder="" class="span12">
        </div>
      </div>
    </div>

    <div class="span3">
      <div class="control-group">
        <label class="control-label" for="fax">Fax</label>
        <div class="controls">
          <input id="fax" name="fax" ng-model="user.facsimileTelephoneNumber" type="text" placeholder="" class="span12">
        </div>
      </div>
    </div>
  </div>

  <div class="row-fluid">
    <div class="span10">
      <label class="control-label">Address</label>
      <textarea type="text" name="postalAddress" ng-model="user.postalAddress" class="span12" placeholder="Address" />
    </div>
  </div>

  <div class="row-fluid">
    <div class="span5 bgcolor">
      <label>Organization</label>
      <input type="text" class="span12 user-orgs" ng-model="user.org" placeholder="Organization">
    </div>
    <div class="span5 bgcolor">
      <label>Title</label>
      <input type="text" class="span12" ng-model="user.title" placeholder="Title">
    </div>
  </div>
  <div class="row-fluid">
    <div class="span10">
      <label>Description</label>
      <textarea type="text" name="description" class="span12" ng-model="user.description" placeholder="Description" />
    </div>
  </div>

  <!-- Textarea -->

  <div class="form-actions">
    <a href="javascript:window.history.back();" class="btn cancel">Cancel</a>
    <button ng-click="save()" ng-disabled="isClean() || userForm.$invalid"
            class="btn btn-primary save">Save</button>
  </div>
</form>
